package com.tt.plat8.user.sercurity.dao;

import com.tt.plat8.api.user.IRoleCode;
import com.tt.plat8.core.GenericOpenJpaDao;
import com.tt.plat8.user.api.security.dao.IRoleCodeDao;
import com.tt.plat8.user.entities.RoleCode;

import javax.persistence.EntityManager;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: tangtao
 * Date: 14-2-20
 * Time: 下午4:17
 * To change this template use File | Settings | File Templates.
 */
public class RoleCodeDaoImpl extends GenericOpenJpaDao<IRoleCode,Long> implements IRoleCodeDao {

    public void setEntityManager(EntityManager em) {
        super.setEntityManager(em);
        super.setPersistentClass(RoleCode.class);

    }
    @Override
    public List<IRoleCode> findAllRoleCode() {
        List<IRoleCode> roleCodeList = this.getAll();
        if(roleCodeList!=null){
              for(IRoleCode roleCode : roleCodeList){
                  roleCode.getFunctions();
              }
        }
        return this.getAll();
    }
}
